

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" scroll="no">

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<link rel="shortcut icon" href="${ctx }static/favicon.ico" type="image/x-icon" />
 <!--Basic Styles-->
<link href="${ctx }framework/css/font.css" rel="stylesheet" />
<link href="${ctx }framework/miniui/themes/material/miniui.css" rel="stylesheet" />
<link href="${ctx }framework/css/app.min.1.css" rel="stylesheet" type="text/css" />
<link href="${ctx }framework/css/app.min.2.css" rel="stylesheet" type="text/css" />
<script src="${ctx }framework/main.js" type="text/javascript"></script>
<!-- 配置文件 -->
<script type="text/javascript" src="${ctx}eao/static/ueditor/ueditor.config.js"></script>
<!-- 编辑器源码文件 -->
<script type="text/javascript" src="${ctx}eao/static/ueditor/ueditor.all.js"></script>
<style type="text/css">html, body{margin:0;padding:0;border:0;width:100%;height:100%;overflow:hidden;}</style>
<script>
var menuId = "";
Page.onLoad(function(){});
function onTreeClickBranch(e){
	var Title = e.node.Title;
	var Id = e.node.Id;
	$("#ueTitle").text(Title);
	$("#ueId").val(Id);
	var dc = {
			Id : Id,
	};
   var ue = UE.getEditor('container');
	Server.sendRequest("EaoGrid.findXTGS", dc,
			function(response) {
				if (response.Status == 1) {
					if(response.data.Content){
						ue.setContent(response.data.Content);
					}else{
						ue.setContent("");
					}
				} else {
					ue.setContent("");
				}
			});
}

var newQueryString = null;
function onTabsActiveChanged(e){
	e.sender.tryReload(newQueryString, e.sender.getTab(e.index));
}

function onhelpTreeLoad(e){
	if(e.sender.getRootNode().children.length > 0){
		e.sender.selectNode(e.sender.getRootNode().children[0]);
	}
}

function add(){
	mini.open({
		   title:"新建系统概述",
		   url:"${ctx}eao/setting/addXTGSDialog.jhtml?Type=1",
		   width:500,
		   height:280,
		   onOk : function(){save("EaoGrid.saveOrUpdateHelpMenu")}
	});
}
function sort(){
	mini.open({
	   title:"系统概述排序",
	   url:"${ctx}eao/setting/moveXTGSDialog.jhtml?Type=1",
	   width:500,
	   height:400,
	   onOk : function(){
		    $D.close();
			mini.get('helpTree').reload();
		},
		onCancel:function(){
			$D.close();
			mini.get('helpTree').reload();
		},
		ondestroy: function (action) { 
			$D.close();
			mini.get('helpTree').reload();
	    }
	});
}

function edit(e){
	var Id;
	if(e){
		Id=e.row.Id;
	} else {
		var arr = mini.get('helpTree').getSelectedValue();
		if(!arr[0]){
			mini.alert("请先选择要编辑的行!");
			return;
		}
		Id=arr[0];
	}
	var option=({
		   title:"修改",
		   url:"${ctx}eao/setting/updateXTGSDialog.jhtml?Id="+Id,
		   width:500,
		   height:280
		});
		option.onOk = function(){save("EaoGrid.saveOrUpdateHelpMenu")};;
	mini.open(option);
}

function save(method){
	var form = $DW.mini.getForm('form2');
	var dc = form.getData();
	if(form.isValid() == false){
		return;
	}
	Server.sendRequest(method,dc,function(response){
		if(response.Status == 1) {
			top.mini.showTips({content:response.Message,state:'success'});
			$D.close();
			mini.get('helpTree').reload();
		} else {
			mini.alert(response.Message);
		}
	});  
}

function del(){
	var arr = mini.get('helpTree').getSelectedValue();
	var arr2 = mini.get('helpTree').getSelectedNode();
	if(arr2.children){
		mini.alert("请先设置子节点");
		return;
	} 
	if(!arr||arr.length==0){
		mini.alert("请先选择要删除的记录！");
		return;
	}
	var dc = {Id:arr.join()};
	 mini.confirm("确认删除？", function(action){
		if(action == "ok"){
			Server.sendRequest("EaoGrid.delHelpMenu",dc,function(response){
				if(response.Status == 1) {
					top.mini.showTips({content:response.Message,state:'success'});
					mini.get('helpTree').reload();
				} else {
					mini.alert(response.Message);
				}
			});
		}
		}); 
}

function enable(){
	setMenuStatus("0");
}
function disable(){
	mini.confirm("确认停用？", function(action){
		if(action == "ok"){
			setMenuStatus("1");
		}
	});
}
function setMenuStatus(flag){
	var arr = mini.get('helpTree').getSelectedValue();
	var arr2 = mini.get('helpTree').getSelectedNode();
	if(arr2.children){
		mini.alert("请先设置子节点");
		return;
	} 
	if(!arr || arr.length == 0){
		mini.alert("请先选择一条记录");
		return;
	}
	var dc = {Id:arr.join(),IsShow:flag};
	Server.sendRequest("EaoGrid.setIsDelete",dc,function(response){
		if(response.Status == 1) {
			top.mini.showTips({content:response.Message,state:'success'});
			mini.get('helpTree').reload();
		} else {
			mini.alert(response.Message);
		}
	});
}
function statusRender(e){
	if(e.record.IsShow == '0'){
		return '<i class="iconfont icon-circle-active c-green"></i>';
	} else {
		return '<i class="iconfont icon-ban c-red"></i>';
	}
}
</script>


</head>
<body class="body-list" style="background:#F9F9F9;">
<div class="mini-toolbar" id="toolbar1">
    <a class="mini-button" iconCls="icon-add" onclick="add();"  plain="true">新建</a>
    <a class="mini-button" iconCls="icon-edit" onClick="edit()"  plain="true">编辑菜单</a>
    <a class="mini-button" iconCls="icon-remove" onClick="del()" plain="true">删除</a>
    <a class="mini-button" iconCls="icon-sort" onClick="sort()"  plain="true">菜单排序</a>
    <a class="mini-button" iconCls="icon-cricle-active" onClick="enable()"  plain="true">启用</a>
    <a class="mini-button" iconCls="icon-ban" onClick="disable()"   plain="true">停用</a>
</div>
<div id="layout1" class="mini-layout" style="width:100%;height:100%;">
 	<div region="west" width="220" showheader="false" allowResize="false">
 		<div style="height:100%">
			<div class="mini-fit" style="padding-top:3px;">
			 	 <div id="helpTree" 
					class="mini-treegrid z-depth-1" 
					expandOnLoad="2" 
					onload="onhelpTreeLoad" 
					onnodeclick="onTreeClickBranch" 
					style="width:100%;" 
					idField="Id" 
					parentField="ParentId" 
					resultAsTree="false" 
					showTreeIcon="true"
					method="EaoGrid.getMenus"
				 	treeColumn="Title" 
					showTreeLines="true" 
					showPager="false" 
					ajaxOptions="{data:{Type:'1'}}"
				 >
				    <div property="columns">
				        <div name="Title" field="Title" width="100" >菜单名称</div>
				        <div field="state" width="30" renderer="statusRender">启用</div>
				    </div>
				</div> 
			</div>
 		</div>
    </div>
<div title="center" region="center" >
	<div class="search-area">
		<div class="pull-left">
			<span id="ueTitle" style="font-size: 20px;margin-top: 30px;">系统概述</span>
			<input id="ueId" type="hidden"/>
		</div>
		<div class="pull-right">
			<input type="button" value="保存" onclick="saveContent()">
		</div>
	</div>
	<!-- 加载编辑器的容器 -->
	<script id="container" name="content" type="text/plain" style="height: 70%"></script>
</div>
</div>
<!-- 实例化编辑器 -->
<script type="text/javascript">
   var ue = UE.getEditor('container', {
       autoHeightEnabled: true,
       autoFloatEnabled: true,
       toolbars: [
    	   ['undo', 'redo', '|',
               'bold', 'italic', 'underline', 'fontborder', 'strikethrough', 'removeformat', 'formatmatch', '|', 'forecolor', 'backcolor', 'selectall', 'cleardoc', '|',
               'rowspacingtop', 'rowspacingbottom', 'lineheight', '|',
               'customstyle', 'paragraph', 'fontfamily', 'fontsize', '|',
               'directionalityltr', 'directionalityrtl', 'indent', '|',
               'justifyleft', 'justifycenter', 'justifyright', 'justifyjustify', '|', 'touppercase', 'tolowercase', '|',
               'link', 'unlink', '|',
               'emotion', '|',
               'horizontal', 'date', 'time', 'spechars', '|',
               'help']
           ]
   });
   function saveContent(){
	   var ue = UE.getEditor('container');
	   var Content = ue.getContent()
	   var Id = $("#ueId").val();
	   if(!Id){
		   top.mini.showTips({content:'请选择要编辑的行!',state:'info'});
			return;
	   }
		var dc = {
				ParentId : Id,
				Content:Content
		};
		Server.sendRequest("EaoGrid.addMenuContent", dc,
			function(response) {
				if (response.Status == 1) {
					top.mini.showTips({
						content : response.Message,
						state : 'success'
					});
				} else {
					top.mini.warn(response.Message);
				}
			});
}
</script>
</body>
</html>
<!-- Generated by Wisc cost:95ms ip:123.14.79.104 -->